import request from './request'
import { Message } from 'element-ui'

const Format = {
  // 文件上传器
  fileUploader(formData, url, headers) {
    return new Promise((resolve, reject) => {
      request
        .request({
          url: url,
          method: 'post',
          data: formData,
          timeout: 10000,
          headers: headers
        })
        .then(res => {
          Message.success(res.msg)
          resolve(res)
        }).catch(err => {
          reject(err)
        })
    })
  }
}
export default Format
